#include "TutorialImages.h"

#include "Camera.h"
#include "ProfileManager.h"
#include "Game.h"

TutorialImages::TutorialImages(void)
{
	//WASD, JKL
	levelImageIDs[0].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_0_1.png") );
	levelImageIDs[0].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_0_2.png") );
	levelImageIDs[0].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_0_3.png") );
	levelImageIDs[0].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_0_4.png") );
	levelImageIDs[0].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_0_5.png") );
	levelImageIDs[0].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_0_6.png") );

	//Arrow Keys, ZXC
	levelImageIDs[1].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_1_1.png") );
	levelImageIDs[1].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_1_2.png") );
	levelImageIDs[1].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_1_3.png") );
	levelImageIDs[1].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_1_4.png") );
	levelImageIDs[1].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_1_5.png") );
	levelImageIDs[1].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_1_6.png") );

	//WASD, ZXC
	levelImageIDs[2].push_back( levelImageIDs[0][0] );
	levelImageIDs[2].push_back( levelImageIDs[1][1] );
	levelImageIDs[2].push_back( levelImageIDs[0][2] );
	levelImageIDs[2].push_back( levelImageIDs[1][3] );
	levelImageIDs[2].push_back( levelImageIDs[1][4] );
	levelImageIDs[2].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_3_6.png") );

	//Arrow Keys, JKL
	levelImageIDs[3].push_back( levelImageIDs[1][1] );
	levelImageIDs[3].push_back( levelImageIDs[0][1] );
	levelImageIDs[3].push_back( levelImageIDs[0][2] );
	levelImageIDs[3].push_back( levelImageIDs[0][3] );
	levelImageIDs[3].push_back( levelImageIDs[0][4] );
	levelImageIDs[3].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_4_6.png") );

	//XBOX Controller
	levelImageIDs[4].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_5_1.png") );
	levelImageIDs[4].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_5_2.png") );
	levelImageIDs[4].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_5_3.png") );
	levelImageIDs[4].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_5_4.png") );
	levelImageIDs[4].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_5_5.png") );
	levelImageIDs[4].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_5_6.png") );

	//Arcade
	//levelImageIDs[5].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_6_1.png") );
	//levelImageIDs[5].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_6_2.png") );
	//levelImageIDs[5].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_6_3.png") );
	//levelImageIDs[5].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_6_4.png") );
	//levelImageIDs[5].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_6_5.png") );
	//levelImageIDs[5].push_back( CSGD_TextureManager::GetInstance()->LoadTexture("Textures/Tutorials/Level1/tutorial_6_6.png") );
}


TutorialImages::~TutorialImages(void)
{
	//TODO: unload all textures, clear vector
}

void TutorialImages::Render(int controlScheme) const
{
	int posX, posY;
	for(unsigned int curImage = 0; curImage < levelImageIDs[controlScheme].size(); ++curImage)
	{
		posX = posY = 0;

		//set position of image to draw
		switch(curImage)
			{
			case 0:
				posX = 100;
				posY = Game::GetInstance()->GetScreenHeight() - 470;
				break;
			case 1:
				posX = 800;
				posY = Game::GetInstance()->GetScreenHeight() - 390;
				break;
			case 2:
				posX = 450;
				posY = Game::GetInstance()->GetScreenHeight() - 370;
				break;
			case 3:
				posX = 1500;
				posY = Game::GetInstance()->GetScreenHeight() - 470;
				break;
			case 4:
				posX = 2090;
				posY = Game::GetInstance()->GetScreenHeight() - 350;
				break;
			case 5:
				posX = 1200;
				posY = Game::GetInstance()->GetScreenHeight() - 470;
				break;
			}


		if(levelImageIDs[controlScheme][curImage] != -1)
		{
			CSGD_TextureManager::GetInstance()->Draw(levelImageIDs[controlScheme][curImage],
					posX - (int)Camera::GetInstance()->OffsetX(),  posY - (int)Camera::GetInstance()->OffsetY());
		}

	}
}